#encoding=utf-8
import socket
import time

HOST = '192.168.137.59'           #服务器的ip
#一号机192.168.137.84
#二号机192.168.137.59
PORT = 6667                    #服务器端口
 
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)  #以TCP协议模式进行通信
sock.connect((HOST,PORT))         #连接服务器
def monitor_goto():
    while True:
        while True:
            x=0
            y=0
            data=sock.recv(1024)
            data1 = data.decode()
            count = data1.split(',', 2)  # standard
            print(count)
            x=float(count[0])
            y=float(count[1])    
            print("x:",x,"y:",y)
            time.sleep(1)
            if (x!=0 and y!=0):
                destation=[[x,y]]#收到坐标
                print("飞行目标点为",destation)
                sock.close()#关闭连接
                return#仅接受一个点

monitor_goto()
print("监听已停止")#关闭连接
